<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh_CN"
	lang="zh_CN">
	<head>
		<meta http-equiv="Content-Type"
			content="text/html; charset=UTF-8" />
		<link type="text/css" rel="Stylesheet"
			href="/styles/default.css" />
		<script
			src="/scripts/export/org.jside.E+org.jside.Element+org.jside.sandbox.stream.Zip+org.jside.sandbox.stream.stringToGBKByteArray+org.jside.sandbox.stream.zip_deflate">
		</script>
	</head>
	<body>
	<h1>不支持IE浏览器</h1>
		<form>
			<div style="float:left;width:60%">
				<div id="content">

					<div>路径</div>
					<div>
						<input type="text" name="path" value="文件1" />
					</div>
					<div>内容</div>
					<div>
						<textarea name="content">写点什么？</textarea>
					</div>
					<hr/>
				</div>
				<div>
					<input type="button" onclick="addRow()"
						value="添加新内容" />

					<input type="button" onclick="pack(this.form)"
						value="生成Zip压缩包" />
				</div>
			</div>

			<div style="float:right;width=30%">
				<div>文档注释</div>
				<div>
					<textarea name="comment">随便说点什么吧</textarea>
				</div>
				<hr/>
			</div>
			<div style="clear:both"></div>
		</form>

		<script>
		/*<![CDATA[*/
var content = E("content");
var temp = content.innerHTML;
function addRow(){
    var el = new Element("div");
    el.innerHTML = temp;
    content.parentNode.insertBefore(el,content);
}
function pack(f){
  var zip = new Zip(f.comment.value);
  zip.stringEncoder = stringToGBKByteArray;
  zip.setCompressMethod(zip_deflate);
  var path = f.path;
  var content = f.content;
  if(!content.length){
    path = [path],content = [content ];
  }
  for(var i=0;i<content . length ; i ++){
     var member=zip.addText(path[i].value,content[i].value);
  }
  var url=zip.toDataURL(); window.open(url);
}
//]]>
</script>
	</body>
</html>
